﻿using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class KaChe : MonoBehaviour 
{
    private Animator ani;
    public event Action onAnimationOver;

    void Awake()
    {
        ani = GetComponent<Animator>();
    }
    public void PlayAnimation()
    {
        ani.SetBool("isPlay",true);
    }

    /// <summary>
    /// 动画事件：汽车鸣笛声
    /// </summary>
    public void Horning()
    {
        Debug.Log("鸣笛");
        SoundManager.instance.Play("qichemingdi");
    }

    /// <summary>
    /// 动画事件：急刹车和撞击声
    /// </summary>
    public void EmergencyBreak()
    {
        Debug.Log("EmergencyBreak");
        SoundManager.instance.Play("jishache");
    }
    /// <summary>
    /// 动画事件：惨叫声
    /// </summary>
    public void Screaming()
    {
        Debug.Log("Screaming");
        SoundManager.instance.Play("jianjiaosheng_Man");
    }
    /// <summary>
    /// 动画结束事件
    /// </summary>
    public void OnAnimationOver()
    {
        onAnimationOver();
    }
}
